package com.woniu.command.handcommand;

import com.woniu.command.Command;
import com.woniu.command.handler.HandCommandHandler;
import com.woniu.inlet.vo.WorkingProcedureVo;
import com.woniu.outlet.client.WorkingProcedures;
import com.woniu.outlet.po.ProcessHandover;
import com.woniu.outlet.po.Progress;
import com.woniu.outlet.po.WarehousingApplication;
import com.woniu.util.ApplicationContextHolder;
import com.woniu.util.SnowflakeIdGenerator;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.*;

public class AddHandCommand implements Command<ProcessHandover> {
    private HandCommandHandler handler;


    public AddHandCommand ( ) {
        //ApplicationContextHolder.getApplicationContext()拿到ApplicationContext
        this.handler = ApplicationContextHolder.getApplicationContext()
                .getBean(HandCommandHandler.class);
    }

    @Override
    public void execute (ProcessHandover processHandover) {
        processHandover.setSpare1("未报工");
        processHandover.setHandoverTime(new Date());

//        Progress progress = new Progress();
//        progress.setProPlanId(processHandover.getProPlanId());
//        progress.setProcessId(processHandover.getId().longValue());
//        progress.setGoodProNum(processHandover.getGoodNum());
//        progress.setScrapNum(processHandover.getCostNum());
//        progress.setRepairNum(processHandover.getWasteNum());
//        progress.setUserId(processHandover.getHandoverPersonId());
//        progress.setPassiveUserId(processHandover.getBehandoverPersonId());
//        progress.setHandoverTime(new Date());
//        handler.addProgress(progress);

        handler.addProcessHandover(processHandover);
    }
}
